package com.dl.debugtools

import android.widget.Toast
import androidx.lifecycle.viewModelScope
import com.dl.base.appContext
import com.dl.base.viewmodel.BaseViewModel
import com.dl.debugtools.api.DebugToolsRepository
import kotlinx.coroutines.launch

class DebugViewModel : BaseViewModel() {
    private val apiRepository by lazy { DebugToolsRepository.instance }

    fun setDeviceName(name: String) {
        viewModelScope.launch {
            if (apiRepository.setDeviceName(name)) {
                DebugToolsPreferences.deviceName = name
                Toast.makeText(appContext, "修改成功", Toast.LENGTH_SHORT).show()
            }
        }
    }
}